#ifndef GRAPHIC_DEVICE_BUFFERS_H
#define GRAPHIC_DEVICE_BUFFERS_H
#include "predefine.h"
#include "igobject.h"
namespace Graphic
{
	//////////////////////////////////////////////////////////////////////////
	// Buffers
	//////////////////////////////////////////////////////////////////////////
	enum BufferUsage{
		BU_WRITE_ONLY,
		BU_READ_ONLY,
		BU_READ_WRITE,	
	};

	
	enum FBAttach{
		FBA_DEPTH = 0,
		FBA_STENCIEL,
		FBA_COLOR0,		FBA_COLOR1,
		/*
		FBA_COLOR2,
		FBA_COLOR3,
		FBA_COLOR4,
		*/
		FBA_COUNT
	};

	enum TextureMode{
		TM_CLAMP,	TM_CLAMP_EDGE,
		TM_REPEAT,	TM_REPEAT_MIRROR,
		TM_LINEAR,	TM_NEAREST,	

		TM_CMP_LESS,TM_CMP_R, TM_CMP_NONE,
	};


	class DLL_EXPORT BufferObject : public IGObject
	{
	public:
		virtual ~BufferObject(){}
		virtual void	Upload(const char* data, int size)	= 0;
		virtual void*	Lock(int usage)						= 0;
		virtual void	Unlock()							= 0;
		virtual int		GetSize()							= 0;
	};

	class DLL_EXPORT VertexBuffer : public BufferObject
	{
	public:
		virtual ~VertexBuffer(){}
	};

	class DLL_EXPORT IndexBuffer : public BufferObject
	{
	public:
		virtual ~IndexBuffer(){}
	};

	class DLL_EXPORT VertexDecl : public IGObject
	{
	public:
		virtual ~VertexDecl(){}
		virtual int	GetSize() = 0;
	};


	class VertexStream : public BufferObject
	{
	public:
		virtual ~VertexStream(){}

		virtual void Use() = 0;
		virtual void AttachVertexBuffer(VertexBuffer*, int Location) = 0;
		virtual void AttachIndexBuffer(IndexBuffer*) = 0;
	};

	class Texture : public BufferObject
	{
	public:
		virtual ~Texture(){}
		
		virtual void	SetWrapT(int mode) = 0;
		virtual void	SetWrapS(int mode) = 0;
		virtual void	SetFilterMin(int mode) = 0;
		virtual void	SetFilterMag(int mode) = 0;
		virtual void	SetCompareMode(int mode) = 0;
		virtual void	SetCompareFunc(int mode) = 0;
	};

	class RenderBuffer : public IGObject
	{
	public:
		virtual ~RenderBuffer(){}
	};

	class FrameBuffer : public IGObject
	{
	public:
		virtual ~FrameBuffer(){}

		virtual void	Begin() = 0;
		virtual void	End() = 0;

		virtual int		GetWidth() = 0;
		virtual int		GetHeight() = 0;

		virtual void	Attach(Texture* texture, int attach) = 0;
		virtual void	Attach(RenderBuffer* rb, int attach) = 0;
		virtual void	Detach(int attch) = 0;
	};

	
};


#endif
